package com.cairenhui.trust.auto.task.executor;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cairenhui.trust.auto.task.service.impl.BaseOrgTaskService;
import com.cairenhui.trust.auto.task.util.DateUtils;

/**
 * 
 * @author 黄瑞庆 TODO 部门信息更新 2017年2月27日
 */
@Component
public class BaseOrgFetchExecutor extends EasyAutotaskExecutor {

	private Logger logger = LoggerFactory.getLogger(BaseOrgFetchExecutor.class);

	@Autowired
	private BaseOrgTaskService baseOrgTaskService;

	@Override
	public String getCron() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean inuse() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void execute() {
		logger.info(
				this.getClass().getSimpleName() + "更新营业部门信息开始>>>>>>开始时间{}",
				DateUtils.getStrDate(new Date(), DateUtils.STRDATE_1
						+ DateUtils.HOURS_MINUTES_SECONDS));
		Date start = new Date();

		baseOrgTaskService.sysCrm();

		Date end = new Date();

		logger.info(
				this.getClass().getSimpleName()
						+ "更新营业部门信息结束>>>>>>结束时间{},耗时{}秒",
				DateUtils.getStrDate(new Date(), DateUtils.STRDATE_1
						+ DateUtils.HOURS_MINUTES_SECONDS),
				DateUtils.getTimeDifference(start, end));

	}

}
